package simulator;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;

public class Printer implements Runnable{
	
	private PrintStream out;
	private BufferedReader in;
	private String name = "";
	
	public Printer(String name, InputStream in, PrintStream out) {
		this.in = new BufferedReader(new InputStreamReader(in));
		this.out = out;
		this.name = name;
	}
	
	@Override
	public void run() {
			try {
				String line;
				while((line = in.readLine()) != null){
					out.println(name+": "+line);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
	}
	
}
